import toast from './toast'
import { createApp } from 'vue'

const obj = {}

obj.install = function(app) {
  // 1. 实例化并绑定组件
  const TOAST = createApp(toast);
  const instance = TOAST.mount(document.createElement('div'));

  // 2. 将挂载的Node添加到body中
  document.body.appendChild(instance.$el)

  // 3. 定义全局
  app.config.globalProperties.$TOAST = instance;
}

export default obj